using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerJumpAttackState : PlayerStateBase
{
    bool GroundDetect;
    public PlayerJumpAttackState(Player player, StateMachine stateMachine, string animName) : base(player, stateMachine, animName)
    {

    }
    public override void Enter()
    {
        base.Enter();
        player.SetVelocity(player.GetJumpAttackMovement().x * player.facingDir, player.GetJumpAttackMovement().y);
        GroundDetect = false;
    }
    public override void Update()
    {
        base.Update();
        
        if (player.IsGround && GroundDetect == false)
        {
            animator.SetTrigger("JumpAttackTrigger");
            GroundDetect = true;
            player.SetVelocity(0, rb.velocity.y);
        }
        if (player.IsGround && triggerCalled)
        {
            stateMachine.ChangeState(player.idleState);
        }
    }
    public override void Exit()
    {
        base.Exit();
    }
}
